package com.mingtu.jgspatrol.adapter;

import android.view.View;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.StringUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mingtu.jgspatrol.R;
import com.mingtu.jgspatrol.bean.MyMessageBean;

public class MsgNoticeAdapter extends BaseQuickAdapter<MyMessageBean.PageBean.RecordsBean, BaseViewHolder> {

    public MsgNoticeAdapter() {
        super(R.layout.item_msg_notice);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, MyMessageBean.PageBean.RecordsBean listBean) {

        String title = listBean.getMsgType();
        int status = listBean.getStatus(); // 0:未读 1：已读
        String time = listBean.getCreateTime();
        View viewFlag = helper.getView(R.id.view_flag);
        if (!StringUtils.isEmpty(title)) {
            helper.setText(R.id.tv_title, title);
        }

        if (!StringUtils.isEmpty(time)) {
            helper.setText(R.id.tv_time, time);
        }

        if (status == 0) {
            viewFlag.setVisibility(View.VISIBLE);
        } else {
            viewFlag.setVisibility(View.GONE);
        }
    }

}
